package com.exam.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.exam.mapper.ScoreMapper;
import com.exam.pojo.Score;
import com.exam.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private ScoreMapper scoreMapper;
    @Override
    public List<Score> selectScoreById(Integer studentId) {
        QueryWrapper<Score> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("studentId",studentId);
        return scoreMapper.selectList(queryWrapper);
    }

    @Override
    public List<Score> selectScoreAll(Integer examCode) {
        QueryWrapper<Score> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("examCode", examCode);
        return scoreMapper.selectList(queryWrapper);
    }

    @Override
    public int addScores(Score score) {
        return scoreMapper.addScores(score);
    }


}
